package com.umgsai.thread.thread12;

import java.util.ArrayList;
import java.util.List;

public class MyOneList {
	private List list = new ArrayList<>();
	synchronized public void add(String data){
		System.out.println(System.currentTimeMillis() + Thread.currentThread().getName() + " start to add data to list");
		list.add(data);
		System.out.println(System.currentTimeMillis() + Thread.currentThread().getName() + " finished adding data to list");
	}
	
	synchronized public int getSize(){
		return list.size();
	}
}
